<?php if(!defined('HDPHP_PATH'))exit;C('SHOW_NOTICE',FALSE);?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<meta name="keywords" content="">
<meta name="description" content="">
<?php if(!defined('HDPHP_PATH'))exit;C('SHOW_NOTICE',FALSE);?>
<link rel="stylesheet" href="http://127.0.0.1/cms/cms/Template/default/css/style.css" />
<link type="text/css" rel="stylesheet" href="http://127.0.0.1/cms/cms/Static/hdjs/hdjs.css"/>
<script type="text/javascript" src="http://127.0.0.1/cms/cms/Static/js/jq17.js"></script>
<script type="text/javascript" src="http://127.0.0.1/cms/cms/Static/hdjs/hdjs.js"></script>
<script type="text/javascript" src="http://127.0.0.1/cms/cms/Template/default/js/js.js"></script>
<script type="text/javascript">
	var checkUser = "<?php echo U('User/ajaxCheckUser');?>";
	var checkNick = "<?php echo U('User/ajaxCheckNickName');?>";
	var checkCode = "<?php echo U('User/ajaxCheckCode');?>";
	var checkLogin = "http://127.0.0.1/cms/cms/Index/user/ajaxLoginReturn";
	var ajaxPingLun = "http://127.0.0.1/cms/cms/Index/user/ajaxLoginReturn";
$(function(){
	$('#loginclose').click(function(){
		$(this).parents('.login_hide_box').hide();
	});
	$('#regclose').click(function(){
		$(this).parents('.reg_hide_box').hide();
	});
})
	
</script>
<script src="http://127.0.0.1/cms/cms/Static/js/ajaxlogin.js"></script>
<script type="text/javascript" src="http://127.0.0.1/cms/cms/Template/default/js/validate.js"></script>

</head>
<body>
	<!-- 顶部100%灰色区域 -->
	<div id="top_dark_box">
		<!-- 中间1200px宽度区域 -->
		<div id="top_dark">
			<a href="http://127.0.0.1/cms/cms"><img src="http://127.0.0.1/cms/cms/Template/default/images/others/logo.jpg" id="logo" /></a>
			<!-- 导航菜单 -->
			<ul id="menu">
				<?php
	$navList = M('category')->field('cid,cname,ctitle,htmldir,is_archtml')->where('pid=0')->limit(10)->all();
	foreach($navList as $navs):
	$navs['url'] = getCateUrl($navs['is_archtml'],$navs['htmldir'],$navs['cid']);
?>
	
				<li>
					<a href="<?php echo $navs['url'];?>"><?php echo $navs['cname'];?></a>
				</li>
				
<?php
	endforeach;
?>
			</ul>
			<!-- 导航菜单结束 -->
			<!-- 用户登录 -->
			
			<div id="loginInfo" class='loginInfo'>
				<div id="islogin" style="display:none;"><span></span><a href="http://127.0.0.1/cms/cms/Index/user/loginout">退出</a></div>
			 <div id="isout" style="display:none;">
				<a href="javascript:showLoginBox()" class="top_login">用户登录</a>
				<a href="javascript:showRegBox();">注册</a>
				</div>
			</div>
			<!-- 用户登录对应隐藏区域 -->
			<form id="loginForm" action="http://127.0.0.1/cms/cms/Index/user/login" method="post">
			<div class="login_hide_box">
				
				<img src="http://127.0.0.1/cms/cms/Template/default/images/sanjiao.gif" alt="" />
				<div class="middle">
					<p>用户名：<span id="hd_username"></span> <a href="javascript:;" id="loginclose">关闭</a></p>
					<input type="text" name="username" class="text" />
					<p>密码：<span id="hd_password"></span></p>
					<input type="password" name="password" class="text" />
					<input type="submit" value="" class="sub" />
				</div>
				<div class="bottom">
					<a  href="javascript:showRegBox();" class="reg">注册</a>
				</div>
			</div>
			</form>
			
			<!-- 用户注册对应隐藏区域 -->
			<form id="regForm" action="http://127.0.0.1/cms/cms/Index/user/register" method="post">	
			<div class="reg_hide_box">
				<img src="http://127.0.0.1/cms/cms/Template/default/images/sanjiao.gif" alt="" />
				<div class="middle">
					<p>用户名：<a href="javascript:;" id="regclose">关闭</a></p>
					<input type="text" name="username_reg" class="text username" />
					<p>昵称：</p>
					<input type="text" name="nickname" class="text nickname" />
					<p>密码：</p>
					<input type="password" name="password_reg1" class="text password" />
					<p>确认密码：</p>
					<input type="password" name="password_reg2" class="text password" />
					<p>验证码：</p>
					<img src="http://127.0.0.1/cms/cms/Index/user/code" id="code" onclick="this.src=this.src + '&' + Math.random()"/>
					<input type="text"  name="code" class="text password_d" />
					<input type="submit" value="注册" class="sub" />
				</div>
			</div>
			</form>
		</div>
		<!-- 中间1200px宽度区域结束 -->
	</div>
	<!-- 顶部灰色100%区域结束 -->
	
	<!-- 顶部最新消息区域 -->
	<div id="latest_news_box">
		<div id="latest_news">
			<p><span class="title">最新消息：
			<?php
		$result = M('article')->field('htmldir,cname,is_archtml,aid,sendtime,click,title,thumb,digest,author,category_cid')->join('__article__ a JOIN __category__ c ON a.category_cid=c.cid')->where('is_recycle=0')->order('sendtime DESC')->limit(1)->all();
		foreach($result as $v):
			//组合图片图片
			$v['thumb']  = 'http://127.0.0.1/cms/cms/'.$v['thumb'];
			$v['commnum'] = K('Comment')->findCountComment($v['aid']);
			$category = K('Category')->findCate($v['category_cid']);
			$v['category_name'] = $category['cname'];
			//生成连接地址
			$v['url'] = getStaticPath($v['is_archtml'],$v['htmldir'],$v['aid']);
			
			 
?>	
	<a href="<?php echo $v['url'];?>"><?php echo $v['title'];?></a>
<?php
	endforeach;
?>	
			</span>
					
			</p>
		</div>
	</div>
	<!-- 顶部最新消息区域结束 -->
	<!-- 主体区域 -->
	
	<!-- 主体区域 -->
	<div id="main">
		<!-- main最上面的说明文字 -->
		    <?php if($currentCate){ ?>
		<div class="top">以下是分类 <span><?php echo $currentCate['cname'];?></span> 下的文章
			<div class="son" style="">
				子分类:
				<?php
		$result = K('category')->where("cid IN(32,30,29,31,24,25,26,27,28)")->all();
		foreach($result as $soncate):
			$soncate['url'] = getCateUrl($field['is_listhtml'],$field['htmldir'],$soncate['cid'].'.html');
?>	

					<a href="<?php echo $soncate['url'];?>"><?php echo $soncate['cname'];?></a>|	
				
<?php
	endforeach;
?>
				
			</div>
		</div>
		
		<?php } ?>
		<!-- main最上面的说明文字结束 -->

		<!-- 左侧区域 -->
		<div class="left">
			<!-- 列表页介绍 -->
			<div class="list_description">列表描述</div>
			<!-- 列表页介绍结束 -->
			<ul class="arc_list">
				<?php
		//总条数
		$count = M('article')->where(" is_recycle=0 AND aid IN(31,35,36)")->count();
		$pageObj = new Page($count,10,10);
		$page = $pageObj->show();
		$result = M()->join('__article__ a JOIN __category__ c ON a.category_cid=c.cid')->where(" is_recycle=0 AND aid IN(31,35,36)")->order("sendtime DESC")->limit($pageObj->limit())->all();
		foreach($result as $art):
			$aid = $art['aid'];
			$art['commentcount'] = M('comment')->where("article_aid=$aid")->count();
			$art['description'] = M('article_data')->where("article_aid=$aid")->getField('description');
			$art['url'] = getStaticPath($art['is_archtml'],$art['htmldir'],$art['aid']);
			$c = K('Category')->findCate($art['category_cid']);
			$art['category_name'] = $c['cname'];
			$art['curl'] = getCateUrl($art['is_listhtml'],$art['htmldir'],$art['cid'].'.html');
			$art['thumb']  = 'http://127.0.0.1/cms/cms/'.$art['thumb'];
?>
	
				<li>
					<div class="pic">
						<img src="<?php echo $art['thumb'];?>" style="height:110px;width:150px;" />
					</div>
					<h3><a href="<?php echo $art['url'];?>"><?php echo $art['title'];?></a></h3>
					<span class="date"><?php echo date('m-d',$art['sendtime']);?></span>
					<a href="<?php echo $art['url'];?>" class="comment"><?php echo $art['commentcount'];?>条评论</a>
					<span class="browse_number"><?php echo $art['click'];?>次浏览</span>
					<p class="description"><?php echo $art['description'];?></p>
				</li>
				
<?php
	endforeach;
?>
			</ul>

			<!-- 分页 -->
			<ul class="pagelist">
				<?php echo $page;?>
			</ul>
			<!-- 分页结束 -->
		</div>
		<!-- 左侧区域结束 -->
	<?php if(!defined('HDPHP_PATH'))exit;C('SHOW_NOTICE',FALSE);?>
<!-- 右侧区域 -->
		<div class="right">
			<div class='hd_title'>
				<strong>标签云</strong>	
			</div>
			<div id="tagBox" class='tags'>
				<?php
		$result = K('Tag')->findAllTagLimit(20);
		foreach($result as $tag):
			$tid = $tag['tid']; 
			$midd = M('article_tag')->where("tag_tid=$tid")->all();
			if(!$midd){
				continue;
			}
?>
	
				<a href="<?php echo U('list/index',array('tid'=>$tag['tid']));?>"><?php echo $tag['tagname'];?></a>
				
<?php
	endforeach;	
?>
			</div>
			<div class='hd_title'>
				<strong>热门文章</strong>	
			</div>
			<ul class='arc_list'>
					<?php
		$result = K('article')->findSpeExp('is_recycle=0','click DESC',8);
		foreach($result as $hotart):
		$hotart['thumb']  = 'http://127.0.0.1/cms/cms/'.$hotart['thumb'];
		$hotart['commnum'] = K('Comment')->findCountComment($hotart['aid']);
		//生成连接地址
		$hotart['url'] = getStaticPath($hotart['is_archtml'],$hotart['htmldir'],$hotart['aid']);
?>
		
					<li>
						<div class='image'>
							<a href="<?php echo $hotart['url'];?>">
								<img src="<?php echo $hotart['thumb'];?>" alt="<?php echo hd_substr($hotart['title'],23,'...');?>" />
							</a>
						</div>
						<h2><a href="<?php echo $hotart['url'];?>"><?php echo hd_substr($hotart['title'],23,'...');?></a></h2>
						<p>
							<em><?php echo date('m-d',$hotart['sendtime']);?></em><span><?php echo $hotart['commnum'];?>条评论</span>
						</p>
					</li>
					
<?php
	endforeach;
?>
			</ul>
			<div class='hd_title'>
				<strong>推荐文章</strong>	
			</div>
			
			<ul class='arc_list'>
					<?php
		$result = K('article')->findSpeExp('is_recycle=0 AND attr LIKE "%推荐%"','click DESC',8);
		foreach($result as $recom):
		$recom['thumb']  = 'http://127.0.0.1/cms/cms/'.$recom['thumb'];
		$recom['commnum'] = K('Comment')->findCountComment($recom['aid']);
		//生成连接地址
		$recom['url'] = getStaticPath($recom['is_archtml'],$recom['htmldir'],$recom['aid']);
?>
		
					<li>
						<div class='image'>
							<a href="<?php echo $recom['url'];?>">
								<img src="<?php echo $recom['thumb'];?>" alt="<?php echo hd_substr($recom['title'],25,'...');?>"/>
							</a>
						</div>
						<h2><a href="<?php echo $recom['url'];?>"><?php echo hd_substr($recom['title'],25,'...');?></a></h2>
						<p>
							<em><?php echo date('m-d',$recom['sendtime']);?></em><span><?php echo $recom['commnum'];?>条评论</span>
						</p>
					</li>
					
<?php
	endforeach;
?>		
			</ul>
		</div>
		<!-- 右侧区域结束 -->

	</div>
	<!-- 主体区域结束 -->
	<!-- 底部浅灰色导航区域 -->
	<?php if(!defined('HDPHP_PATH'))exit;C('SHOW_NOTICE',FALSE);?>
	<!-- 底部浅灰色导航区域 -->
	<div id="bottom_menu_box" style="margin-top:30px;">
		<div class="bottom_menu">
			<?php
		$result = K('flink')->showAllFlink(1,10,'sort DESC');
		foreach($result as $flink):
		$flink['url'] = 'http://'.$flink['url'];
		$flink['logo']  = 'http://127.0.0.1/cms/cms/'.$flink['logo'];
		
?>
	
			<dl>
				    <?php if($flink['logo']){ ?>
					<dt><a href="<?php echo $flink['url'];?>" style="margin-top:10px;"><img src="<?php echo $flink['logo'];?>" alt="<?php echo $flink['fname'];?>" /></a></dt>
					<?php }else{ ?>
					<dt><a href="<?php echo $flink['url'];?>"><?php echo $flink['fname'];?></a></dt>
				<?php } ?>
			</dl>
			
<?php
	endforeach;
?>	
		</div>
	</div>
	<!-- 底部浅灰色导航区域结束 -->

	<!-- 底部版权区域 -->
	<div id="bottom_copyright_box">
		<div class="bottom_copyright">
			版权信息:Copyright 2015 <?php echo $copy;?>
		</div>
	</div>
	<!-- 底部版权区域结束 -->
	
</body>
</html>

	
</body>
</html>
